home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / excell1a / form2.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1999-10-09  |  11.7 KB  |  386 lines

  1. VERSION 5.00
  2. Object = "{54E91B3E-3171-11D3-977A-96567B857403}#2.0#0"; "AMCLABEL.OCX"
  3. Begin VB.Form Form2 
  4.    BackColor       =   &H000000FF&
  5.    BorderStyle     =   3  'Fixed Dialog
  6.    ClientHeight    =   3525
  7.    ClientLeft      =   45
  8.    ClientTop       =   45
  9.    ClientWidth     =   4680
  10.    ControlBox      =   0   'False
  11.    LinkTopic       =   "Form2"
  12.    MaxButton       =   0   'False
  13.    MinButton       =   0   'False
  14.    ScaleHeight     =   3525
  15.    ScaleWidth      =   4680
  16.    ShowInTaskbar   =   0   'False
  17.    StartUpPosition =   2  'CenterScreen
  18.    Begin PAMCLabel.AMCLabel lblTwo 
  19.       Height          =   285
  20.       Left            =   1680
  21.       Top             =   1920
  22.       Width           =   2715
  23.       _ExtentX        =   4789
  24.       _ExtentY        =   503
  25.       Caption         =   "to view the user dictionary."
  26.       AutoSize        =   -1  'True
  27.       BackColor       =   255
  28.       CaptionShadowColor=   8421504
  29.       CaptionHighLightColor=   16777215
  30.       BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  31.          Name            =   "Comic Sans MS"
  32.          Size            =   9.75
  33.          Charset         =   0
  34.          Weight          =   700
  35.          Underline       =   0   'False
  36.          Italic          =   0   'False
  37.          Strikethrough   =   0   'False
  38.       EndProperty
  39.    End
  40.    Begin PAMCLabel.AMCLabel lblOne 
  41.       Height          =   285
  42.       Left            =   1680
  43.       Top             =   1560
  44.       Width           =   2640
  45.       _ExtentX        =   4657
  46.       _ExtentY        =   503
  47.       Caption         =   "Click the book to the left "
  48.       AutoSize        =   -1  'True
  49.       BackColor       =   255
  50.       CaptionShadowColor=   8421504
  51.       CaptionHighLightColor=   16777215
  52.       BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  53.          Name            =   "Comic Sans MS"
  54.          Size            =   9.75
  55.          Charset         =   0
  56.          Weight          =   700
  57.          Underline       =   0   'False
  58.          Italic          =   0   'False
  59.          Strikethrough   =   0   'False
  60.       EndProperty
  61.    End
  62.    Begin VB.PictureBox Picture1 
  63.       Appearance      =   0  'Flat
  64.       AutoRedraw      =   -1  'True
  65.       AutoSize        =   -1  'True
  66.       BackColor       =   &H000000FF&
  67.       BorderStyle     =   0  'None
  68.       ForeColor       =   &H80000008&
  69.       Height          =   840
  70.       Left            =   240
  71.       Picture         =   "Form2.frx":0000
  72.       ScaleHeight     =   840
  73.       ScaleWidth      =   1185
  74.       TabIndex        =   9
  75.       ToolTipText     =   "User Dictionary"
  76.       Top             =   1440
  77.       Width           =   1185
  78.    End
  79.    Begin VB.PictureBox picBlock 
  80.       BackColor       =   &H000000FF&
  81.       BorderStyle     =   0  'None
  82.       Height          =   1695
  83.       Left            =   120
  84.       ScaleHeight     =   1695
  85.       ScaleWidth      =   4455
  86.       TabIndex        =   8
  87.       Top             =   1080
  88.       Width           =   4455
  89.    End
  90.    Begin VB.CommandButton cmdCancel 
  91.       BackColor       =   &H000000FF&
  92.       Cancel          =   -1  'True
  93.       Caption         =   "&Cancel"
  94.       BeginProperty Font 
  95.          Name            =   "MS Sans Serif"
  96.          Size            =   8.25
  97.          Charset         =   0
  98.          Weight          =   700
  99.          Underline       =   0   'False
  100.          Italic          =   0   'False
  101.          Strikethrough   =   0   'False
  102.       EndProperty
  103.       Height          =   495
  104.       Left            =   2400
  105.       Style           =   1  'Graphical
  106.       TabIndex        =   7
  107.       Top             =   2880
  108.       Width           =   1215
  109.    End
  110.    Begin VB.CommandButton cmdOK 
  111.       BackColor       =   &H000000FF&
  112.       Caption         =   "&OK"
  113.       Default         =   -1  'True
  114.       BeginProperty Font 
  115.          Name            =   "MS Sans Serif"
  116.          Size            =   8.25
  117.          Charset         =   0
  118.          Weight          =   700
  119.          Underline       =   0   'False
  120.          Italic          =   0   'False
  121.          Strikethrough   =   0   'False
  122.       EndProperty
  123.       Height          =   495
  124.       Left            =   960
  125.       Style           =   1  'Graphical
  126.       TabIndex        =   6
  127.       Top             =   2880
  128.       Width           =   1215
  129.    End
  130.    Begin VB.TextBox txtSubject 
  131.       BeginProperty Font 
  132.          Name            =   "MS Sans Serif"
  133.          Size            =   12
  134.          Charset         =   0
  135.          Weight          =   700
  136.          Underline       =   0   'False
  137.          Italic          =   0   'False
  138.          Strikethrough   =   0   'False
  139.       EndProperty
  140.       ForeColor       =   &H00FF0000&
  141.       Height          =   375
  142.       Left            =   120
  143.       TabIndex        =   2
  144.       Top             =   1440
  145.       Width           =   4335
  146.    End
  147.    Begin VB.OptionButton optTwoPlayer 
  148.       BackColor       =   &H000000FF&
  149.       Caption         =   "Two Player"
  150.       BeginProperty Font 
  151.          Name            =   "Comic Sans MS"
  152.          Size            =   9.75
  153.          Charset         =   0
  154.          Weight          =   700
  155.          Underline       =   0   'False
  156.          Italic          =   0   'False
  157.          Strikethrough   =   0   'False
  158.       EndProperty
  159.       ForeColor       =   &H00C00000&
  160.       Height          =   255
  161.       Left            =   2160
  162.       TabIndex        =   1
  163.       Top             =   480
  164.       Width           =   1575
  165.    End
  166.    Begin VB.OptionButton optOnePlayer 
  167.       BackColor       =   &H000000FF&
  168.       Caption         =   "One Player"
  169.       BeginProperty Font 
  170.          Name            =   "Comic Sans MS"
  171.          Size            =   9.75
  172.          Charset         =   0
  173.          Weight          =   700
  174.          Underline       =   0   'False
  175.          Italic          =   0   'False
  176.          Strikethrough   =   0   'False
  177.       EndProperty
  178.       ForeColor       =   &H00C00000&
  179.       Height          =   255
  180.       Left            =   600
  181.       TabIndex        =   0
  182.       Top             =   480
  183.       Value           =   -1  'True
  184.       Width           =   1455
  185.    End
  186.    Begin VB.TextBox txtWord 
  187.       BeginProperty Font 
  188.          Name            =   "MS Sans Serif"
  189.          Size            =   12
  190.          Charset         =   0
  191.          Weight          =   700
  192.          Underline       =   0   'False
  193.          Italic          =   0   'False
  194.          Strikethrough   =   0   'False
  195.       EndProperty
  196.       ForeColor       =   &H00FF0000&
  197.       Height          =   375
  198.       Left            =   120
  199.       TabIndex        =   4
  200.       Top             =   2280
  201.       Width           =   4335
  202.    End
  203.    Begin VB.Label Label2 
  204.       AutoSize        =   -1  'True
  205.       BackStyle       =   0  'Transparent
  206.       Caption         =   "Word"
  207.       ForeColor       =   &H00C00000&
  208.       Height          =   195
  209.       Left            =   120
  210.       TabIndex        =   5
  211.       Top             =   2040
  212.       Width           =   390
  213.    End
  214.    Begin VB.Label Label1 
  215.       AutoSize        =   -1  'True
  216.       BackStyle       =   0  'Transparent
  217.       Caption         =   "Subject"
  218.       ForeColor       =   &H00C00000&
  219.       Height          =   195
  220.       Left            =   120
  221.       TabIndex        =   3
  222.       Top             =   1200
  223.       Width           =   540
  224.    End
  225.    Begin VB.Line Line1 
  226.       X1              =   120
  227.       X2              =   4440
  228.       Y1              =   960
  229.       Y2              =   960
  230.    End
  231.    Begin VB.Line Line2 
  232.       BorderColor     =   &H00C0C0C0&
  233.       BorderWidth     =   2
  234.       X1              =   120
  235.       X2              =   4440
  236.       Y1              =   960
  237.       Y2              =   960
  238.    End
  239. Attribute VB_Name = "Form2"
  240. Attribute VB_GlobalNameSpace = False
  241. Attribute VB_Creatable = False
  242. Attribute VB_PredeclaredId = True
  243. Attribute VB_Exposed = False
  244. Public Function dash()
  245.     Dim WordLen As Integer
  246.     Dim LenHangWord
  247.     Dim ST
  248.     Dim NewHangWord
  249.     Dim CharHangWord
  250.         
  251.     WordLen = Len(hangWord)
  252.     ST = 1
  253.     LenHangWord = Len(hangWord)
  254.     'this will place "-" into the word label
  255.     Do While WordLen > 0
  256.         Form1.lblWord.Caption = Form1.lblWord.Caption + "-"
  257.         WordLen = WordLen - 1
  258.     Loop
  259.     'this will change spaces into "/" in the string hangWord
  260.     Do Until LenHangWord = 0
  261.         CharHangWord = Mid(hangWord, ST, 1)
  262.         LenHangWord = LenHangWord - 1
  263.         
  264.         If CharHangWord = " " Then
  265.             Mid(hangWord, ST) = "/"
  266.         End If
  267.         
  268.         ST = ST + 1
  269.     Loop
  270.     'this will replace spaces in the word label with "/"
  271.     ST = 1
  272.     LenHangWord = Len(hangWord)
  273.     Do Until LenHangWord = 0
  274.         CharHangWord = Mid(hangWord, ST, 1)
  275.         LenHangWord = LenHangWord - 1
  276.         
  277.         If CharHangWord = "/" Then
  278.             Dim MyString
  279.             MyString = Form1.lblWord.Caption
  280.             Mid(MyString, ST) = "/"
  281.             Form1.lblWord.Caption = MyString
  282.         End If
  283.         
  284.         ST = ST + 1
  285.     Loop
  286.     If hangWord = hangword2 Then
  287.         cmdOk_Click
  288.     End If
  289.     Form1.Show
  290. End Function
  291. Private Sub cmdCancel_Click()
  292.     Form1.Enabled = True
  293.     Unload Me
  294. End Sub
  295. Private Sub cmdOk_Click()
  296.     Form2.Enabled = True
  297.     If optOnePlayer.Value = True Then
  298.         Dim Time1 'used for random time
  299.         Dim Time2 'used for random time - holds random
  300.         Dim InputData 'used to determine length
  301.         Dim LineNum 'used to determine length - holds length
  302.         Dim MyValue 'Final random
  303.         Dim temp 'holds line
  304.         Dim temp21 'variable, when matched with MyValue will stop a loop
  305.         Dim tempsub 'Holds final Subject
  306.         Dim tempword 'Holds final Word
  307.         
  308.         Time1 = Time
  309.         Time2 = Right(Time1, 1)
  310.         Time2 = Time2 + Rnd
  311.         Time2 = Time2 / 10
  312.         
  313.         Open "Dictionary.txt" For Input As #1
  314.         Do While Not EOF(1)
  315.            Line Input #1, InputData
  316.            LineNum = LineNum + 1
  317.         Loop
  318.         Close #1
  319.         
  320.         MyValue = Int((LineNum * Time2) + 1)   '
  321.         
  322.         Open "Dictionary.txt" For Input As #1
  323.         Do While temp21 <> MyValue
  324.             
  325.             Line Input #1, temp
  326.             temp21 = temp21 + 1
  327.         Loop
  328.         Close #1
  329.         
  330.         tempsub = Left(temp, 30)
  331.         Trim tempsub
  332.         
  333.         tempword = Mid(temp, 31)
  334.         tempword = LCase(tempword)
  335.             
  336.         Form1.lblSubject.Caption = tempsub
  337.         hangSubject = tempsub
  338.         hangWord = tempword
  339.         dash 'goto dash function
  340.         Unload Me
  341.         
  342.     Else
  343.         hangWord = LCase(txtWord.Text)
  344.         hangSubject = txtSubject.Text
  345.         If Len(hangWord) = 0 Then
  346.             MsgBox "Enter a word"
  347.             Exit Sub
  348.         End If
  349.         
  350.         If Len(hangSubject) = 0 Then
  351.             MsgBox "Enter a Subject"
  352.             Exit Sub
  353.         End If
  354.         
  355.         Form1.lblSubject.Caption = hangSubject
  356.         MsgBox hangWord
  357.         dash
  358.         Unload Me
  359.     End If
  360. End Sub
  361. Private Sub Form_Load()
  362.     Form1.Enabled = False
  363. End Sub
  364. Private Sub optOnePlayer_Click()
  365.     txtSubject.Text = ""
  366.     txtSubject.Enabled = False
  367.     txtWord.Text = ""
  368.     txtWord.Enabled = False
  369.     picBlock.Visible = True
  370.     Picture1.Visible = True
  371.     lblOne.Visible = True
  372.     lblTwo.Visible = True
  373. End Sub
  374. Private Sub optTwoPlayer_Click()
  375.     txtSubject.Enabled = True
  376.     txtWord.Enabled = True
  377.     picBlock.Visible = False
  378.     Picture1.Visible = False
  379.     lblOne.Visible = False
  380.     lblTwo.Visible = False
  381. End Sub
  382. Private Sub Picture1_Click()
  383.     Form5.Show
  384.     Form2.Enabled = False
  385. End Sub
  386.